<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>learn react</title>
    <script src="js/react.js"></script>
    <script src="js/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
  </head>
  <body>
    <div id="example"></div>
    <script type="text/babel">
      var LikeButton = React.createClass({
        getInitialState: function() {
          return {liked: false}
        },
        handelClick: function(event) {
          this.setState({liked: !this.state.liked});
        },
        render: function() {
          var text = this.state.liked? 'like' : 'haven\'t liked'
          return (
            <p onClick={this.handelClick}>
            You {text} this, Click this to change
            </p>
          )
        }
      })
      ReactDOM.render(
        <LikeButton />,
        document.getElementById('example')
      )
    </script>
  </body>
</html>
